<?php

namespace App\HttpController\Api\Admin;

use App\Service\Admin\GradeService;
use Swoole\Http\Status;

/**
 * 年级管理-控制器
 * @author LZH
 * @since: 2021/08/12
 * Class Grade
 * @property GradeService service
 */
class Grade extends AdminBase
{
    /**
     * 初始化方法
     * @author LZH
     * @since: 2021/08/12
     */
    protected function init(): void
    {
        /** @var @var service GradeService */
        $this->service = new GradeService();
    }

    /**
     * 获取级别，即届数
     * @return bool
     * @author LZH
     * @since 2021/08/16
     */
    public function getSchoolYear(): bool
    {
        return $this->message(Status::OK, $this->service->getSchoolYear());
    }

    /**
     * 获取学部
     * @author LZH
     * @since 2021/08/16
     */
    public function getDeptType(): bool
    {
        return $this->message(Status::OK, $this->service->getDeptType('dept_type'));
    }

    /**
     * 获取按年级分组的所有班级
     * @author LZH
     * @since 2021/8/18
     */
    public function getClassesGroupByGrade()
    {
        return $this->message(Status::OK, $this->service->getClassesGroupByGrade());
    }
}
